package org.tp8.sampleapp.loader.jobs.teacher.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.tp8.sampleapp.loader.exc.SampleLoaderException;
import org.tp8.sampleapp.loader.jobs.teacher.service.intf.TeacherOutputService;
import org.tp8.sampleapp.loader.service.intf.RESTService;
import org.tp8.sampleapp.model.Teacher;

@Service
public class TeacherOutputServiceImpl implements TeacherOutputService {

	@Autowired
	private RESTService restService;

	private String url = "http://localhost:8080/sample-app/services/rest/teacher/save";

	private String inContentType = "application/xml";

	private String outContentType = "application/xml";

	private String username = "admin";

	private String password = "123456";

	@Override
	public Teacher insert(Teacher teacher) throws SampleLoaderException {
		return restService.post(url, inContentType, outContentType, username,
				password, teacher, Teacher.class);
	}

}
